package com.ruoyi.framework.config;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

/**
 * @Author: wangyb
 * @Date: 2021/6/28 10:50 下午
 */
@Component
public class FeignBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
		//处理SpringBootTest 时报错问题，
		// 参见 https://github.com/codecentric/spring-boot-admin/issues/1408#issuecomment-622418135
		// https://github.com/codecentric/spring-boot-admin/issues/1258#issuecomment-534916708
		BeanDefinition bd1 = configurableListableBeanFactory.getBeanDefinition("feignContext");
		bd1.setDependsOn("registrationListener");

//		BeanDefinition bd2 = configurableListableBeanFactory.getBeanDefinition("springClientFactory");
//		bd2.setDependsOn("registrationListener");
	}
}
